<template>
  <a-date-picker
    style="width:100%"
    :value="value"
    :disabled-date="disabledDate"
    @change="handleDateChange"/>
</template>

<script>
import moment from 'moment'

export default {
  props: {
    prop: String,
    cb: String,
    value: [String, Number]
  },
  data() {
    return {

    }
  },
  methods: {
    handleDateChange(instance, dateValue) {
      this.$emit('input', dateValue)
      this.$emit('handle-date-change', { cb: this.cb, prop: this.prop })
    },
    disabledDate(current) {
      return current && current < moment().startOf('day')
    }
    // dealDate(dateValue) {
    //   const dateForm = moment(dateValue)
    //   const Y = dateForm.year()
    //   const M = dateForm.month() > 10 ? dateForm.month() : `0${dateForm.month()}`
    //   const D = dateForm.date() > 10 ? dateForm.date() : `0${dateForm.date()}`
    //   return `${Y}-${M}-${D}`
    // },
  }
}
</script>
